package proxy.dynamicproxy;

import proxy.factory.impl.AppleFactory;
import proxy.factory.impl.HuaWeiFactory;

public class Client {
    public static void main(String[] args) {
        TaobaoProxy taobao = new TaobaoProxy();

        taobao.setPcFactory(new HuaWeiFactory());
        int price = taobao.sell(1);
        System.out.println("客户在淘宝上买了一台华为电脑，价格：" + price);
        System.out.println("--------------------------------------");

        taobao.setPcFactory(new AppleFactory());
        price = taobao.sell(1);
        System.out.println("客户在淘宝上又买了一台苹果电脑，价格：" + price);
    }
}
